﻿using Abp.Domain.Repositories;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Yozeev.BusinessLogic;

namespace Yozeev.Controllers.Stats.Filters
{
    /// <summary>
    /// 游船装饰器
    /// </summary>
    public class BoatFilter: AbstractFilter
    {
        private readonly IRepository<Boat, Guid> _boatRep;
        public BoatFilter(IRepository<Boat, Guid> boatRep)
        {
            _boatRep = boatRep;
        }

        public override void Decorate(Dictionary<string, IEnumerable<object>> Data)
        {
            if (Data.ContainsKey("Boats")) return;
            var boats = _boatRep.GetAll();
            Data.Add("Boats", boats.ToList());
        }
    }
}
